package com.ruoyi.project.warehouse.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.project.warehouse.domain.RyDepotItem;
import com.ruoyi.project.warehouse.domain.RyDepotItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.warehouse.mapper.LockRyDepotItemMapper;
import com.ruoyi.project.warehouse.domain.LockRyDepotItem;
import com.ruoyi.project.warehouse.service.ILockRyDepotItemService;

/**
 * 锁定Service业务层处理
 *
 * @author you
 * @date 2022-09-07
 */
@Service
public class LockRyDepotItemServiceImpl implements ILockRyDepotItemService
{
    @Autowired
    private LockRyDepotItemMapper lockRyDepotItemMapper;

    /**
     * 查询锁定
     *
     * @param id 锁定主键
     * @return 锁定
     */
    @Override
    public LockRyDepotItem selectLockRyDepotItemById(Long id)
    {
        return lockRyDepotItemMapper.selectLockRyDepotItemById(id);
    }

    /**
     * 查询锁定列表
     *
     * @param lockRyDepotItem 锁定
     * @return 锁定
     */
    @Override
    public List<RyDepotItemVo> selectLockRyDepotItemList(LockRyDepotItem lockRyDepotItem)
    {
        return lockRyDepotItemMapper.selectLockRyDepotItemList(lockRyDepotItem);
    }

    /**
     * 新增锁定
     *
     * @param ryDepotItemVo 锁定
     * @return 结果
     */
    @Override
    public int insertLockRyDepotItem(RyDepotItemVo ryDepotItemVo)
    {

        //入库记录新增
        LockRyDepotItem lockRyDepotItem = new LockRyDepotItem();
        lockRyDepotItem.setInventoryId(ryDepotItemVo.getInventoryId());
        lockRyDepotItem.setDepotId(ryDepotItemVo.getDepotId());
        lockRyDepotItem.setOperNumber(ryDepotItemVo.getOperNumber());//锁定数量
        lockRyDepotItem.setOperTime(DateUtils.getNowDate());//操作时间
        lockRyDepotItem.setRemark(ryDepotItemVo.getRemark());
        lockRyDepotItem.setHeaderType("2");//2代表锁定
        lockRyDepotItem.setLockStatus(ryDepotItemVo.getLockStatus());//锁定状态
        return lockRyDepotItemMapper.insertLockRyDepotItem(lockRyDepotItem);
    }

    /**
     * 修改锁定
     *
     * @param lockRyDepotItem 锁定
     * @return 结果
     */
    @Override
    public int updateLockRyDepotItem(LockRyDepotItem lockRyDepotItem)
    {
        return lockRyDepotItemMapper.updateLockRyDepotItem(lockRyDepotItem);
    }

    @Override
    public int updateUserSysUserStatus() {
        int a = 0;
        System.out.println(lockRyDepotItemMapper);
        a=lockRyDepotItemMapper.updateUserSysUserStatus();
        System.out.println(a);
        return a;
    }

    /**
     * 批量删除锁定
     *
     * @param ids 需要删除的锁定主键
     * @return 结果
     */
    @Override
    public int deleteLockRyDepotItemByIds(Long[] ids)
    {
        return lockRyDepotItemMapper.deleteLockRyDepotItemByIds(ids);
    }

    /**
     * 删除锁定信息
     *
     * @param id 锁定主键
     * @return 结果
     */
    @Override
    public int deleteLockRyDepotItemById(Long id)
    {
        return lockRyDepotItemMapper.deleteLockRyDepotItemById(id);
    }
}
